package com.nwpu.am.mapper;

import com.nwpu.am.pojo.entity.Order;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface OrderMapper {
    @Insert("INSERT INTO tb_order (order_id, create_time, user_id, status, pay_money, complete_time, description,owner_name,owner_tel) VALUES (#{orderId}, #{creatTime}, #{userId}, #{status}, #{payMoney}, #{completeTime}, #{description},#{ownerName},#{ownerTel})")
    void insertOrder(Order order);

    @Select("SELECT * FROM tb_order WHERE order_id = #{orderId}")
    Order selectOrderById(int orderId);

    int updateOrder(Order order);

    @Delete("DELETE FROM tb_order WHERE order_id = #{orderId}")
    int deleteOrderById(int orderId);
    @Select("SELECT * FROM tb_order")
    ArrayList<Order> selectAll();
}
